//
//  L2String.h
//  Lesson2
//
//  Created by Alexander Trifonov on 20.04.12.
//  Copyright (c) 2012 fgengine@gmail.com. All rights reserved.
//

#import "L2String.h"

@implementation L2String

- (void) execute
{
    NSString *string1 = @"String one";
    NSString *string2 = [NSString stringWithString:string1];
    NSString *string3 = [[NSString alloc] initWithString:string1];
    [string3 release];
    
    NSLog(@"-L2String-------------------------------");
    
    NSString *formatString = [NSString stringWithFormat:@"Строка (%@) имеет длинну %i символов" ,string1,  string1.length];
    NSLog(@"%@",formatString);
    
    NSLog(@"----------------------------------------");
    
    NSLog(@"Строка (%@) имеет длинну %i символов" ,string1,  string1.length);
    
    NSLog(@"----------------------------------------");
    
    NSString *lower = [@"LOWER CASE ME" lowercaseString];
    NSString *capitalize = [@"capitalize me" capitalizedString];
    NSLog(@"%@", lower);
    NSLog(@"%@", capitalize);
    
    NSLog(@"----------------------------------------");
    
    NSString *s1 = [@"Weight bench: " stringByPaddingToLength:20 withString:@" " startingAtIndex:0];
    NSString *s2 = [@"Bicycle: " stringByPaddingToLength:20 withString:@" " startingAtIndex:0];
    NSString *s3 = [@"Painting: " stringByPaddingToLength:20 withString:@" " startingAtIndex:0];
    NSLog(@"%@ %@", s1, @"$150.00");
    NSLog(@"%@ %@", s2, @"$215.00");
    NSLog(@"%@ %@", s3, @"$ 50.00");
    
    NSLog(@"----------------------------------------");
    
    BOOL prefix = [@"http://imaladec.com" hasPrefix:@"http"];
    BOOL suffix = [@"http://imaladec.com" hasSuffix:@".com"];
    NSLog(@"Has prefix? %i" ,prefix);
    NSLog(@"Has suffix? %i" ,suffix);
    
    NSLog(@"----------------------------------------");
    
    NSLog(@"Has prefix? %@" ,prefix? @"YES" : @"NO");
    NSLog(@"Has suffix? %@" ,suffix? @"YES" : @"NO");
    
    NSLog(@"----------------------------------------");
    
    NSString *s4 = @"Bill";
    NSString *s5 = @"John";
    BOOL equal = [s4 isEqualToString:s5];
    NSLog(@"Strings is equal? %@", equal? @"YES" : @"NO");
    
    NSLog(@"----------------------------------------");
    
    NSString *students = @"Tom, Bill, Joe";
    NSArray *sArray = [students componentsSeparatedByString:@", "];
    NSLog(@"%@", sArray);
    
    NSLog(@"----------------------------------------");
}

@end
